package com.rrd.itext.xmlBean.wrapper;

import com.rrd.itext.xmlBean.converter.DataZoneConverter;
import com.rrd.itext.xmlBean.dataBean.DataXmlBaseBean;
import com.rrd.itext.xmlBean.dataBean.DataXmlPage;
import com.rrd.itext.xmlBean.dataBean.DataXmlSection;
import com.thoughtworks.xstream.XStream;

public class DataXStreamWrapper {
	private static final String SECTIONS = "sections";
	private static final String PAGES = "pages";
	private static final String ZONES = "zones";

	private XStream xstream;

	public XStream initXStream() {
		xstream = new XStream();
		xstream.processAnnotations(DataXmlBaseBean.class);
		xstream.addImplicitCollection(DataXmlBaseBean.class, SECTIONS);
		xstream.addImplicitCollection(DataXmlSection.class, PAGES);
		xstream.addImplicitCollection(DataXmlPage.class, ZONES);

		DataZoneConverter dataZoneConverter = new DataZoneConverter();
        xstream.registerConverter(dataZoneConverter);
        
		return xstream;
	}

	public XStream getXstream() {
		return xstream;
	}

	public void setXstream(XStream xstream) {
		this.xstream = xstream;
	}

}
